package com.ruoyi.web.controller.buy;

import com.ruoyi.buy.domain.entity.PO.BuyUserBrand;
import com.ruoyi.buy.domain.entity.buy0010.Buy0010TableData;
import com.ruoyi.buy.service.IBuy0010Service;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 角色信息
 * 
 * @author ruoyi
 */
@RestController
@Transactional(rollbackFor = Exception.class)
@RequestMapping("/buy/buy0010")
public class buy0010Controller extends BaseController {
    @Autowired
    private IBuy0010Service buy0010Service;


    /**
     * 查询库存信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Buy0010TableData para)
    {
        startPage();
        List<Buy0010TableData> list = buy0010Service.getList(para);
        return getDataTable(list);
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        BuyUserBrand para = new BuyUserBrand();
        para.setUserId(id);
        return success(buy0010Service.getBrandListByUser(para));
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PostMapping(value = "/save")
    public AjaxResult save(@RequestBody List<BuyUserBrand> list)
    {
        buy0010Service.save(list);
        return AjaxResult.success();
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PostMapping(value = "/delItem")
    public AjaxResult delItem(@RequestBody BuyUserBrand para)
    {
        buy0010Service.deleteItem(para);
        return AjaxResult.success();
    }
}
